package com.sk.cardeal.dialog;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.dyhdyh.widget.loading.dialog.LoadingDialog;
import com.sk.cardeal.R;
import com.sk.cardeal.base.BaseDialogFragment;
import com.sk.cardeal.callback.CashPayCallback;
import com.sk.cardeal.utils.SnackUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by sk on 2018/4/18.
 */

public class CashPayDialogFragment extends BaseDialogFragment {
    @BindView(R.id.tv_tip)
    TextView tvTip;
    @BindView(R.id.ed_price)
    EditText edPrice;
    @BindView(R.id.cancel)
    TextView cancel;
    @BindView(R.id.sure)
    TextView sure;
    Unbinder unbinder;

    private CashPayCallback cashPayCallback;


    public CashPayCallback getCashPayCallback() {
        return cashPayCallback;
    }

    public void setCashPayCallback(CashPayCallback cashPayCallback) {
        this.cashPayCallback = cashPayCallback;
    }

    @Override
    protected int getContentView() {
        return R.layout.dialog_cash_tip_pay;
    }


    @OnClick({R.id.cancel, R.id.sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.cancel:
                dismiss();
                break;
            case R.id.sure:
                dismiss();
                if(cashPayCallback!=null){
                    if(TextUtils.isEmpty(edPrice.getText().toString()))
                    {
                        SnackUtils.showError(mRootView,"请输入实收金额!");
                        return;
                    }
                    cashPayCallback.cashPay(edPrice.getText().toString());
                }
                break;
        }
    }
}
